/*
 *  wlan_test.c  --  wlan test application
 *
 *  Copyright (c) 2017 Rockchip Electronics Co. Ltd.
 *  Author: linqihao <kevein.lin@rock-chips.com>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * 	 http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
//WLAN test program
#include <stdio.h>

//open()相关头文件
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <stdlib.h>


//error相关头文件
#include <errno.h>
#include <string.h>
#include "common.h"

typedef		unsigned short	    uint16;
typedef		unsigned int	    uint32;
typedef		unsigned char	    uint8;

#define Version_Hardware	"/etc/HWVERSION"
#define Version_Software	"/etc/SWVERSION"


int main(int argc, char *argv[])
{
    if(argc != 1)
    {
        printf("The input parameter is incorrect! \n");
        return -1;
    }

    if(fopen(FACTORYMODE, "r") == NULL)
    {
        printf("Please enter testMode first! \n");
        return -1;
    }
    FILE *fp;
    int ret = 0;
    fp = fopen(Version_Hardware, "r");
    lseek(fp, 0, SEEK_SET);
    float *sw = (float *)malloc(sizeof(float));
    float *hw = (float *)malloc(sizeof(float));
    //float sw,hw;
    if(fp == NULL)
    {
        printf("Read Version_Hardware Error !\n");
    }
    else
    {
        fscanf(fp, "%f", hw);
        printf("Version_Hardware=[%.1f] \n", *hw);
        fclose(fp);
    }

    fp = fopen(Version_Software, "r");
    if(fp == NULL)
    {
        printf("Read Version_Software Error !\n");
    }
    else
    {
        fscanf(fp, "%f", sw);
        printf("Version_Software=[%.1f] \n", *sw);
        fclose(fp);
    }
    return 0;
}
